﻿namespace WP7Contrib.Services.BingMaps.Model
{
    using System.Device.Location;
    using Common;

    public class PushPin : BaseModel
    {
        private GeoCoordinate point;
        private int iconStyle;
        private string label;

        public PushPin()
        {
            this.point = new GeoCoordinate();
        }
 
        public GeoCoordinate Point
        {
            get
            {
                return this.point;
            }
            set
            {
                this.SetPropertyAndNotify(ref this.point, value, () => this.Point);
            }
        }

        public int IconStyle
        {
            get
            {
                return this.iconStyle;
            }
            set
            {
                this.SetPropertyAndNotify(ref this.iconStyle, value, () => this.IconStyle);
            }
        }

        public string Label
        {
            get
            {
                return this.label;
            }
            set
            {
                var tmp = value;
                if (value != null && value.Length > 2)
                {
                    tmp = tmp.Substring(0, 2);
                }
                this.SetPropertyAndNotify(ref this.label, tmp, () => this.Label);
            }
        }
    }
}